package com.alpaak.controller;

import com.alpaak.domain.User;
import com.alpaak.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author liudongkui
 * @desp TODO
 * @datetime 2018/9/4 10:39
 */
@Controller
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/add")
    @ResponseBody
    public void addUser(User user) {
        userService.addUser(user);
    }

    @RequestMapping("/get")
    @ResponseBody
    public User getUser(Integer id) {
       return userService.get(id);
    }
}
